package cn.jiyun.dao.mapper;

import cn.jiyun.dao.domain.Stu;
import cn.jiyun.dao.domain.StuCount;
import cn.jiyun.dao.domain.StuVo;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface StuMapper extends Mapper<Stu> {
    List<StuVo> findAllVO( StuVo stuVo );

    @Select("select stu.*,tname,mname from stu,teacher,major where stu.tid = teacher.id and stu.mid = major.id and stu.id = #{stu.id}")
    StuVo findShow( Integer id );

    @Select("select mname,count(s.id) num from major m left join stu s on m.id = s.mid and (isdelete = 1) group by mname")
    List<StuCount> tongji();

    @Select("select stu.*,tname,mname from stu,teacher,major where stu.tid = teacher.id and stu.mid = major.id and (isdelete = 1)")
    List<StuVo> findout();

}
